//
//  ViewController.m
//  Emoticon
//
//  Created by 袁量 on 2017/8/12.
//  Copyright © 2017年 袁量. All rights reserved.
//

#import "ViewController.h"
#import "EmoticonController.h"
#import "EmoticonManager.h"
#import "EmoticonPackage.h"
#import "EmoticonAttachment.h"
#import "UITextView+emoji.h"
#import "NetworkingTools.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextView *textView;
@property (nonatomic, strong) EmoticonController *emoticonVc;

@end

@implementation ViewController
- (IBAction)send:(id)sender {
   NSString *str = [self.textView getEmoticonString];
    
   NSLog(@"%@",str);

}

- (void)viewDidLoad {
    [super viewDidLoad];
    _textView.inputView = _textView.inputView != nil ? nil : self.emoticonVc.view;
//    EmoticonManager *manager = [[EmoticonManager alloc] init];
//    for (EmoticonPackage *package in manager.packages) {
////        NSLog(@"%@",package.emoticons);
//    }
    NetworkingTools *tool_1 = [NetworkingTools ShareManager];
    NetworkingTools *tool_2 = [NetworkingTools ShareManager];
    NetworkingTools *tool_3 = [[NetworkingTools alloc] init];
    NetworkingTools *tool_4 = [tool_3 copy];
    NSLog(@"%@",tool_1);
    NSLog(@"%@",tool_2);
    NSLog(@"%@",tool_3);
    NSLog(@"%@",tool_4);
    
}
- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    [_textView becomeFirstResponder];
}


- (EmoticonController *)emoticonVc{
    if (!_emoticonVc) {
        __weak typeof(self) weakSelf = self;
        _emoticonVc = [[EmoticonController alloc] initWithEmoticonCallBack:^(Emoticon *emoticon) {
            [[weakSelf textView] insertEmoticon:emoticon];
         }];
    }
    return _emoticonVc;
} 

@end
